package com.neusoft.nepm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neusoft.common.domain.AQIlevel;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AQIlevelMapper extends BaseMapper<AQIlevel> {
    @Select("select * from aqilevel")
    @Results({
            @Result(column = "SO2_max",property = "SO2_max"),
            @Result(column = "SO2_min",property = "SO2_min"),
            @Result(column = "CO_min",property = "CO_min"),
            @Result(column = "CO_max",property = "CO_max"),
            @Result(column = "PM_max",property = "PM_max"),
            @Result(column = "PM_min",property = "PM_min"),
            @Result(column = "level_id",property = "level_id")
    })
    List<AQIlevel> getList();

    @Select("select `describe` from aqilevel where level_id = #{id}")
    String getTip(int id);
    @Select("select remark from aqilevel where level_id = #{id}")
    String getMsg(int id);

    @Select("select * from aqilevel where SO2_min<#{SO2} and SO2_max>#{SO2}")
    @Results({
            @Result(column = "level_id",property = "level_id")
    })
    List<AQIlevel> SO2Test(float SO2);

    @Select("select * from aqilevel where CO_min<#{CO} and CO_max>#{CO}")
    @Results({
            @Result(column = "level_id",property = "level_id")
    })
    List<AQIlevel> COTest(float CO);

    @Select("select * from aqilevel where PM_min<#{PM} and PM_max>#{PM}")
    @Results({
            @Result(column = "level_id",property = "level_id")
    })
    List<AQIlevel> PMTest(float PM);
}
